/*
 * full specialization
 * stack<std::string>
 **/

#pragma once

#include <deque>
#include <string>
#include <stdexcept>

#include "stack_base.h"


template<>
class Stack<std::string>
{
private:
    std::deque<std::string> elems;
    
public:
    void push(std::string const &);
    void pop();
    std::string top() const;
    bool empty() const;
};

void Stack<std::string>::push(std::string const &s)
{
    elems.push_back(s);
}

void Stack<std::string>::pop()
{
    if (elems.empty())
    {
        throw std::out_of_range("Stack<>::pop(): empty stack");
    }

    elems.pop_back();
}

std::string Stack<std::string>::top() const
{
    if (elems.empty())
    {
        throw std::out_of_range("Stack<>::pop(): empty stack");
    }

    return elems.back();
}

bool Stack<std::string>::empty() const
{
    return elems.empty();
}